using UnityEngine;


public static class TextureExtend
{
    /// <summary>
    /// 二进制转图片
    /// </summary>
    /// <param name="bytes"></param>
    /// <param name="width"></param>
    /// <param name="hight"></param>
    /// <returns></returns>
    public static Texture2D GetTexture(this byte[] bytes, int width = 1920, int hight = 1080)
    {
        if (bytes == null)
            return null;

        Texture2D texture2D = new Texture2D(width, hight);
        texture2D.LoadImage(bytes);
        return texture2D;
    }
}